Contour integration solve by residue method